﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using ValidationFramework.Web.MVC.Tests.Fakes;
using Rhino.Mocks;

namespace ValidationFramework.Web.MVC.Tests
{
	[TestFixture]
	public class ClientFunctionCallProviderDictionaryTests
	{
		[TestFixture]
		public class GetProvider
		{
			[Test]
			public void Should_Lookup_Propertly_Lookup_Provider_When_Given_A_Validator_Instance()
			{
				// Arrange
				var validator = new FakeValidator();
				var dictionary = new ClFunctionCallProviderDictionary();

				// Act - Assert
				Assert.IsNull(dictionary.GetProvider(validator));

				dictionary.Add(typeof(FakeValidator).TypeHandle, MockRepository.GenerateStub<IClientFunctionCallProvider>());

				Assert.IsNotNull(dictionary.GetProvider(validator));
			}
		}
	}
}
